﻿@Html.DevExpress().GridView(
            settings =>
            {
                settings.Name = "gvEditing";
                settings.KeyFieldName = "ZSXH";
                settings.CallbackRouteValues = new { Controller = "TaxManager", Action = "TaxManagerListPartial" };
                settings.Width =System.Web.UI.WebControls.Unit.Pixel(1400);

                //settings.Columns.Add(column =>
                //{
                //    column.Caption = "操作";

                //    column.SetDataItemTemplateContent(c =>
                //    {
                //        Html.DevExpress().HyperLink(s => { s.Name = "linkEdit" + c.VisibleIndex; s.Properties.Text = "修改"; s.ToolTip = "修改"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_Edit.png"); s.Properties.ClientSideEvents.Click = "function(){TaxPayerManagerEdit('" + DataBinder.Eval(c.DataItem, "NSRDZDAH") + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();
                //    });
                //    column.Settings.AllowDragDrop = DefaultBoolean.False;
                //    column.Settings.AllowSort = DefaultBoolean.False;
                    
                //    column.Width = 70;
                //});
                
                //settings.Columns.Add(s => 
                //{
                //    s.Name = "ZSXHstr";
                //    s.FieldName = "ZSXHstr";
                //    s.Visible = false;
                //});

                //settings.Columns.Add(s => {
                //    s.Name = "NSRDZDAHstr";
                //    s.FieldName = "NSRDZDAHstr";
                //    s.Visible = false;
                //});
                
               // settings.Columns.Add("NSRSBH", "纳税识别号");
                settings.Columns.Add("YZPZXH", "应征凭证序号");
                settings.Columns.Add("ZSXM_MC", "征收项目");
                settings.Columns.Add("YSKM_MC", "预算科目");
                settings.Columns.Add("SE", "税额");
                settings.Columns.Add("TZLX_MC", "申报调帐类型");
                settings.Columns.Add("SSSQ_Q", "所属期始");
                settings.Columns.Add("SSSQ_Z", "所属期止");
                settings.Columns.Add("YZPZZL_MC", "票证种类");
                settings.Columns.Add("YSSPHM", "系统税票号码");
                settings.Columns.Add("SKSX_MC", "税款属性");
                settings.Columns.Add("YSFPBL_MC", "预算分配比例");
                settings.Columns.Add("SJRQ", "上解日期");
                settings.Columns.Add("RKRQ", "入库日期");
                //settings.Columns.Add("ShowDate", "开户行");
                //settings.Columns.Add("FUpdDateStr", "账号");
             
                settings.SettingsBehavior.AllowSort = false;
                settings.SettingsBehavior.AllowDragDrop = false;
                settings.SettingsBehavior.AllowSelectByRowClick = false;
                settings.SettingsLoadingPanel.Text = "数据读取中...";
                settings.SettingsBehavior.AllowClientEventsOnLoad = false;
                settings.SettingsBehavior.AllowFocusedRow = true;


                settings.ClientSideEvents.BeginCallback = "function(s,e){OnBeginCallback(s,e)}";
                
                settings.CommandColumn.Visible = false;
                settings.CommandColumn.ShowSelectCheckbox = false;
                settings.CommandColumn.Width = System.Web.UI.WebControls.Unit.Pixel(5);

                settings.SettingsPager.Position = System.Web.UI.WebControls.PagerPosition.Bottom;
                settings.SettingsPager.FirstPageButton.Visible = true;
                settings.SettingsPager.LastPageButton.Visible = true;
                settings.SettingsPager.PageSize = EnterpriseFund.Common.GlobalConstant.CONSTRING_PAGESIZE;
                settings.SettingsPager.AlwaysShowPager = true;

                //settings.CommandColumn.SetHeaderTemplateContent(c =>
                //{
                //    Html.DevExpress().CheckBox(settingsCheckBox =>
                //    {
                //        settingsCheckBox.Name = "cbSelectAll";
                //        settingsCheckBox.Properties.ClientSideEvents.CheckedChanged = string.Format("function(s, e) {{ if(s.GetChecked()) {0}.SelectAllRowsOnPage(); else {0}.UnselectAllRowsOnPage(); }}", settings.Name);

                //        if (c.Grid.VisibleRowCount == 0)
                //        {
                //            settingsCheckBox.Enabled = false;

                //        }
                //        else
                //        {
                //            settingsCheckBox.Checked = c.Grid.VisibleRowCount == c.Grid.Selection.Count;
                //        }


                //    }).Render();
                //});


                settings.PageIndexChanged = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    grid.Selection.UnselectAll();
                };
                settings.DataBinding = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    for (int i = 0; i < grid.AllColumns.Count; i++)
                    {
                        if (grid.AllColumns[i].CellStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                        if (grid.AllColumns[i].HeaderStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                    }
                };            
                
                
            }).Bind(Model).GetHtml()